from newton1 import NewTon1
from newton2 import NewTon2
from newton3 import NewTon3
from const import *
import matplotlib.pyplot as plt
import numpy as np
A = np.loadtxt("A.txt")
b = np.loadtxt("b.txt")
x0 = np.loadtxt("x0.txt")
n1 = NewTon1(A, x0)
n2 = NewTon2(A, b, x0)
n3 = NewTon3(A, b)

x1, _ = n1.search()
print("--------------------")
x2, v2, _ = n2.search()
print("--------------------")
v3, _ = n3.search()
print("--------------------")
x3 = n3.calx(v3)

print(max(abs(x1 - x2)))
print(max(abs(v2 - v3)))

